package gui;

import java.awt.GridLayout;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.JPanel;

import mvc.controller.Controller;
import mvc.model.ModelCurve;
import mvc.view.ViewCurve;

public class GuiBlock extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	
	private ArrayList<ViewCurve> views = new ArrayList<ViewCurve>();
	private ArrayList<Controller> controllers = new ArrayList<Controller>()	;
	
	private ModelCurve model;
	
	public GuiBlock(ModelCurve model){
		this.setModel(model);
		init();
	}

	private void init() {
		setLayout(new GridLayout(1,3, 1, 1));
		int BORDER = 10;
		setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, 
                BORDER, BORDER));

	}
	
	public void addViewController(ViewCurve view, Controller controller) {
		views.add(view);
		controllers.add(controller);
		
		super.add(view);
	}

	public void setModel(ModelCurve model) {
		this.model = model;
	}

	public ModelCurve getModel() {
		return model;
	}	
	
	public GuiBlock setTranslate(int x, int y, boolean foo) {
		for(ViewCurve v : views) {
			v.setTranslate(x, y, foo);
		}
		return this;
	}
}
